package com.dotflat.fin.cnst;

import lombok.Setter;

/**
 * 系统常量
 *
 * @author fengshuonan
 * @date 2017年2月12日 下午9:42:53
 */
public interface Const {


    public final Integer PHOTO_ALBUM_PRINT_PRICE = 10;
    /**
     * 状态
     */


    int DISABLED = 0;
    int ENABLED = 1;

    Integer USER_DEFAULT_STAR = 50;

    String TRADE_SUCCESS = "TRADE_SUCCESS";
    String TRADE_FINISHED = "TRADE_FINISHED";

    //    审核状态， 0.未审核， 1.通过, 2 拒绝, 3 请求
    enum APPROVE_STATE{
        NONE(0, "未审核"),
        APPROVED(1, "通过"),
        REFUSED(2, "拒绝") ,
        REQUESTED(3, "请求");

        @Setter
        private int code;

        @Setter
        private String value;

        APPROVE_STATE(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public static APPROVE_STATE get(Integer code){
            if (code == null){
                return NONE;
            }

            for (APPROVE_STATE status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return NONE;
        }
    }


    String PAY_SIGN_TYPE_DEFAULT = "APP";
    String PAY_SIGN_TYPE_APP = "APP";
    String PAY_WECHAT_TRADE_TYPE = "APP";

    //来源类型：0. 无变化 1. 现金动账 2. 项目操作 3. 系统操作
    enum FLOW_SOURCE_TYPE{
        None(0, "无变化"),
        CASH(1, "现金动账") ,
        DEPOSIT(2, "定金动账") ,
        SYSTEM(3, "系统操作");

        @Setter
        private int code;

        @Setter
        private String value;

        FLOW_SOURCE_TYPE(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public static FLOW_SOURCE_TYPE get(Integer code){
            if (code == null){
                return None;
            }

            for (FLOW_SOURCE_TYPE status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return None;
        }
    }

    //类型：0.无变化 1. 进账 2. 出账
    enum FLOW_TYPE{
        None(0, "无变化"),
        INCOME(1, "进账") ,
        EXPENSES(2, "出账") ,
        COMMISION(3, "抽成");

        @Setter
        private int code;

        @Setter
        private String value;

        FLOW_TYPE(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public static FLOW_TYPE get(Integer code){
            if (code == null){
                return None;
            }

            for (FLOW_TYPE status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return None;
        }
    }

    //支付状态   支付状态0:未付款; 1:已付款, 2:支付中
    enum PAY_STATUS{
        None(0, "未付款"),
        PAIED(1, "已付款"),
        PAYING(2, "支付中");

        @Setter
        private int code;

        @Setter
        private String value;

        PAY_STATUS(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public static PAY_STATUS get(Integer code){
            if (code == null){
                return None;
            }

            for (PAY_STATUS status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return None;
        }
    }

    //    资源类型
    enum RES_TYPE{
        None(999, "普通业务", 0),
        DEPOSIT(0, "充值", 0),
        PRODUCT(1, "收费项目", 0),
        PHOTOPRINT(2, "相册打印", 0);

        @Setter
        private int code;

        @Setter
        private String value;

        @Setter
        private int defaultCommissionRate;

        RES_TYPE(int code, String value, int defaultCommissionRate){
            this.code = code;
            this.value = value;
            this.defaultCommissionRate = defaultCommissionRate;
        }

        public int defaultCommissionRate(){return  defaultCommissionRate;};

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public static RES_TYPE get(Integer code){
            if (code == null){
                return None;
            }

            for (RES_TYPE status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return None;
        }
    }

}
